package com.zyw.dev.zyw.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Misl on 2016/1/20.
 */
public abstract class SingleTypeViewAdapter<T> extends BaseViewAdapter<T> {

    /**
     * 构造函数
     *
     * @param context
     * @param dataList
     */
    public SingleTypeViewAdapter(Context context, List<T> dataList) {
        super(context, dataList);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (dataList!=null && dataList.size()>0){
            if (convertView == null){
                convertView = layoutInflater.inflate(layoutForCellView(),null);
            }
            bindToView(position,convertView,dataList.get(position));
           return convertView;
        }
        return null;
    }

    @Override
    public int getTypeCount() {
        return 1;
    }

    @Override
    public int getItemType(int postion) {
        return 1;
    }

    @Override
    public int getViewTypeCount() {
        return getTypeCount();
    }

    @Override
    public int getItemViewType(int position) {
        return getItemType(position);
    }

}
